package thinkingJava.chapter12;

class BaseballException extends Exception {}
class Foul extends BaseballException {}
class Strike extends BaseballException {}

abstract class Inning {
	public Inning() throws BaseballException {
	}
	public void event() throws BaseballException {
	}
	public abstract void atBat() throws Foul,Strike;
	public void walk() {
	}
}
class StormException extends Exception {}
class RainedOut extends StormException {}
class PopFoul extends Foul {}

interface Storm {
	public void event() throws RainedOut;
	public void rainHard() throws RainedOut;
}

public class StomyInning extends Inning implements Storm {
	public StomyInning() throws RainedOut, BaseballException {
	}
	public StomyInning(String s) throws Foul, BaseballException {
	}
	public void rainHard() throws RainedOut {
	}
	public void atBat() throws PopFoul {
	}
	public void event() {
	}
	public static void main(String[] args) {
			try {
				StomyInning si = new StomyInning();
				si.atBat();
			} catch (PopFoul e) {
				System.out.println(" pop foul ");
			} catch (RainedOut e) {
				System.out.println(" rained out ");
			} catch (BaseballException e) {
				System.out.println(" baseball  ");
			}
			try {
				Inning in = new StomyInning();
				in.atBat();
			} catch (RainedOut e) {
				System.out.println(" rained out! ");
			} catch (Foul e) {
				System.out.println(" foul! ");
			} catch (Strike e) {
				System.out.println(" strike! ");
			} catch (BaseballException e) {
				System.out.println(" baseball ! ");
			}
	}
}
